package com.sls.mall.member.web;

import com.sls.common.utils.R;
import com.sls.mall.member.feign.OrderFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;
import java.util.Map;

@Controller
public class MemberWebController {

    @Autowired
    OrderFeignService orderFeignService;

    /**
     * 获取用户订单
     * @param pageNum
     * @param model
     * @return
     */
    @GetMapping("/memberOrder")
    public String memberOrder(@RequestParam(value = "pageNum", defaultValue = "0") Integer pageNum, Model model){
        Map<String, Object> pageMap = new HashMap<>();
        pageMap.put("page", pageNum.toString());
        R r = orderFeignService.listWithItem(pageMap);
        model.addAttribute("orders", r);
        System.out.println(r);
        return "orderList";
    }
}
